let fenye = {
    pagenum: 1,
    pagesize: 6
}
let total = 10
let size = 6
function padding () {
  if (total != 0 && size >= total) {
    return layer.msg('快别点了！消停点吧！！！行吗！！！一天天的！！！')
  }
  $.ajax({
    url: 'http://localhost:8888/api/articles',
    data: fenye,
    success: function (res) {
      if (res.status === 0) {
        total = res.total
        console.log(total);
        let str = '';
        res.data.forEach( item => {
          str += `
            <div class="item">
              <h4>
                <a href="./detail.html?id=${item.id}">${item.title}</a>
              </h4>
              <p class="meta">
                <span>${item.pub_date}分享至</span>
                <a href="javascript:;" class="wechat"></a>
                <a href="javascript:;" class="weibo"></a>
              </p>
              <p class="brief">${item.content}</p>
            </div>
          `
        })
        $('.kr_news_list').html(str);
      }
    }
  })
}
padding();

$('.kr_more').click(function () {
  fenye.pagenum += 1
  size += 6

  padding();
})
